package com.open.thinks.todo.system.common;

import javax.servlet.http.HttpSession;

import com.open.thinks.todo.system.domain.User;

public class WebUtils {
	public static final String ACCESS_SUFFIX;
	public static final String SESSION_LOGIN;

	static {
		SESSION_LOGIN = "open-to-do_login_user";
		ACCESS_SUFFIX = ".html";
	}

	public static User getCurrentUser(HttpSession session) {
		User user = (User) session.getAttribute(SESSION_LOGIN);
		if (user == null) {
			user = new User();
			user.setUser_id(IdGenerator.getGenerator(User.class).generator());
			user.setUser_name("dailey");
			user.setUser_password("dailey");
			user.setEmail("dailey.dai@oracle.com");
		}
		return user;
	}
}
